Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Date formatting | GENIE database

    Hello all,

    I downloaded the csv file of information from the GENIE database. The date format is an integer but it is not formatting right based on the Stata -format- command with %td
    I am getting dates in the future with the command below. Tried converting to string and redoing the code, but it still does not work.

    Is there some universal integer datetime different from the Stata notation of datetime?


    format int_contact %td

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input int int_contact
    19225
    12057
    23505
    23426
    18267
    14626
    20387
    27128
    26404
    22846
    23458
    22923
    24162
    17552
    22454
    30623
    20620
    20938
    24924
    20227
    28111
    25974
    23596
    19412
    26236
    21091
    24064
    15323
    18273
    28853
    25983
    21645
    22076
    24700
    24718
    14358
    24005
    21334
    16547
    26614
        .
        .
    23520
    25368
    20181
    20810
    26671
    29712
    25968
        .
    21781
    17790
    22807
    14095
    28910
    15628
    27122
    18814
    25090
    23287
    16187
    24373
    23461
    23252
    20423
    24361
    15117
    25549
    20972
    26687
    23663
    19305
    25784
    16817
    18465
    26364
    17432
    27058
    20711
    23878
    23303
    24433
    16087
    20546
    25521
    18571
    23287
    15945
    17539
    17151
    16248
    24586
    23095
    22338
    23305
    20326
    16014
    20472
    17557
    15944
    end


  • #2
    I think you will need to pour over the documentation for the GENIE database itself to find out how their date variables work. In Stata, the numeric value for a date is the number of days since 1 Jan 1960. Other systems often use other "base" dates. Microsoft Excel even has two different "base" dates depending on which version you are using! It is highly likely that GENIE also represents dates by number of days since some base date, but they have probably chosen a different base date. It should be explained somewhere in their data dictionary or other documentation.

    Once you find out what their base date is, you can just add or subtract the difference between that date and 1 JAN 1960 to calculate the corresponding number that Stata would use for the same dates. For example, if their base date is 1 JAN 1945 (I just made that up as an example) then their numeric values for a given date will differ from Stata's by
    Code:
    . display td(1jan1960)-td(1jan1945)
    5478
    Consequently if you subtract 5478 from the GENIE numbers, you will get the Stata numeric values corresponding to the GENIE dates.

    Comment


    • #3
      That is very useful. I emailed them since I could not find a file documenting a base date.

      Comment

      Working...
      X